﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

namespace SP_XHWeb.ControlTemplates
{
    public partial class TopBanner : UserControl
    {
        private string AbsolutePath = string.Empty;
        private string RawUrl = string.Empty;

        protected void Page_Load(object sender, EventArgs e)
        {
            AbsolutePath = this.Page.Request.Url.AbsolutePath.ToLower();
            RawUrl = this.Page.Request.RawUrl.ToLower();

            if (!IsPostBack)
            {
                if (RawUrl.StartsWith("/companyinfo"))
                {
                    lblBanner.InnerHtml = "<div class='banner s4-notdlg' style='margin-bottom:8px; height:114px'><img src='/_layouts/images/SP_XHWeb/banner002.jpg' alt='' style='width:964px;height:114px;' /></div> ";
                    //SiteTitle = "公司信息";
                }
                else if (RawUrl.StartsWith("/projectinfo"))
                {
                    lblBanner.InnerHtml = "<div class='banner s4-notdlg' style='margin-bottom:8px; height:114px'><img src='/_layouts/images/SP_XHWeb/banner003.jpg' alt='' style='width:964px;height:114px;' /></div> ";
                    //SiteTitle = "项目信息";
                }
                else if (RawUrl.StartsWith("/infomationcenter"))
                {
                    lblBanner.InnerHtml = "<div class='banner s4-notdlg' style='margin-bottom:8px; height:114px'><img src='/_layouts/images/SP_XHWeb/banner004.jpg' alt='' style='width:964px;height:114px;' /></div> ";
                    //SiteTitle = "资讯中心";
                }
                else if (RawUrl.StartsWith("/enterpriseculture"))
                {
                    lblBanner.InnerHtml = "<div class='banner s4-notdlg' style='margin-bottom:8px; height:114px'><img src='/_layouts/images/SP_XHWeb/banner005.jpg' alt='' style='width:964px;height:114px;' /></div> ";
                    //SiteTitle = "企业文化";
                }
                else if (RawUrl.StartsWith("/knowledgecenter"))
                {
                    lblBanner.InnerHtml = "<div class='banner s4-notdlg' style='margin-bottom:8px; height:114px'><img src='/_layouts/images/SP_XHWeb/banner006.jpg' alt='' style='width:964px;height:114px;' /></div> ";
                    //SiteTitle = "知识中心";
                }
                else if (RawUrl.StartsWith("/_layouts/sp_xhweb/employeedetails.aspx"))
                {
                    lblBanner.InnerHtml = "<div class='banner s4-notdlg' style='margin-bottom:8px; height:114px'><img src='/_layouts/images/SP_XHWeb/banner002.jpg' alt='' style='width:964px;height:114px;' /></div> ";
                    //SiteTitle = "公司信息";
                }
                else if (RawUrl.StartsWith("/_layouts/sp_xhweb/dispformitem.aspx"))
                {
                    string weburl = Request["web_url"].ToString();
                    if (!string.IsNullOrEmpty(weburl))
                    {
                        if (weburl.StartsWith("/companyinfo"))
                        {
                            lblBanner.InnerHtml = "<div class='banner s4-notdlg' style='margin-bottom:8px; height:114px'><img src='/_layouts/images/SP_XHWeb/banner002.jpg' alt='' style='width:964px;height:114px;' /></div> ";
                            //SiteTitle = "公司信息";
                        }
                        else if (weburl.StartsWith("/projectinfo"))
                        {
                            lblBanner.InnerHtml = "<div class='banner s4-notdlg' style='margin-bottom:8px; height:114px'><img src='/_layouts/images/SP_XHWeb/banner003.jpg' alt='' style='width:964px;height:114px;' /></div> ";
                            //SiteTitle = "项目信息";
                        }
                        else if (weburl.StartsWith("/infomationcenter"))
                        {
                            lblBanner.InnerHtml = "<div class='banner s4-notdlg' style='margin-bottom:8px; height:114px'><img src='/_layouts/images/SP_XHWeb/banner004.jpg' alt='' style='width:964px;height:114px;' /></div> ";
                            //SiteTitle = "资讯中心";
                        }
                        else if (weburl.StartsWith("/enterpriseculture"))
                        {
                            lblBanner.InnerHtml = "<div class='banner s4-notdlg' style='margin-bottom:8px; height:114px'><img src='/_layouts/images/SP_XHWeb/banner005.jpg' alt='' style='width:964px;height:114px;' /></div> ";
                            //SiteTitle = "企业文化";
                        }
                        else if (weburl.StartsWith("/knowledgecenter"))
                        {
                            lblBanner.InnerHtml = "<div class='banner s4-notdlg' style='margin-bottom:8px; height:114px'><img src='/_layouts/images/SP_XHWeb/banner006.jpg' alt='' style='width:964px;height:114px;' /></div> ";
                            //SiteTitle = "知识中心";
                        }
                        else
                        {
                            lblBanner.InnerHtml = "<div class='banner s4-notdlg' style='margin-bottom:8px; height:136px'><object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0' width='964' height='136'><param name='movie' value='/_layouts/SP_XHWeb/flash/top_banenr.swf' /><param name='quality' value='high' /><param name='wmode' value='transparent' /><embed src='/_layouts/SP_XHWeb/flash/top_banenr.swf' width='964' height='136' quality='high' pluginspage='http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' wmode='transparent'></embed></object></div>";
                        }
                    }
                }
                else
                {
                    lblBanner.InnerHtml = "<div class='banner s4-notdlg' style='margin-bottom:8px; height:136px'><object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0' width='964' height='136'><param name='movie' value='/_layouts/SP_XHWeb/flash/top_banenr.swf' /><param name='quality' value='high' /><param name='wmode' value='transparent' /><embed src='/_layouts/SP_XHWeb/flash/top_banenr.swf' width='964' height='136' quality='high' pluginspage='http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' wmode='transparent'></embed></object></div>";
                }
            }
        }
    }
}
